package dev.entao.travel.model

import dev.entao.base.*
import dev.entao.page.OptionList
import dev.entao.page.RefUpload
import dev.entao.page.UploadImage
import dev.entao.sql.*
import java.sql.Time

@Label("商家")
class Merchant : Model() {

    @Label("ID")
    @PrimaryKey
    @AutoInc(20200)
    var id: Int by model

    @Label("名称")
    @Index
    var name: String by model

    @Label("省份")
    @Index
    var province: String by model

    @Label("城市")
    @Index
    var city: String by model

    @Label("提供住宿")
    @Index
    @OptionList("0:否", "1:是")
    var hasBed: Int by model

    @Label("管理员")
    @Index
    var adminName: String by model

    @Unique
    @Label("手机号")
    @MaxLength(16)
    @Index
    var phone: String by model

    @HideClient
    @Label("密码")
    var pwd: String by model

    @Label("身份证")
    @MaxLength(32) // 18
    var identNum: String? by model

    @Label("状态")
    @OptionList("0:激活", "1:冻结", "2:删除")
    var status: Int by model

    @UploadImage(32, 360, 600)
    @Label("头像")
    @RefUpload(5)
    var portrait: Int? by model

    @Index
    @Label("创建日期")
    var createDate: DateSQL? by model

    @Index
    @Label("创建时间")
    var createTime: Time? by model

    @DatePattern("yy-MM-dd HH:mm:ss")
    @Label("更新时间")
    var updateTime: Long by model

    @Label("公司")
    var company: String by model

    @Index
    @Label("营业执照")
    var zhizhao: String by model

    @Label("地址")
    var address: String? by model

    @Label("坐标类型")
    @OptionList("WGS84:GPS坐标", "GCJ02:国家测绘局坐标", "BD09ll:百度坐标")
    var locationType: String? by model

    @Label("经度")
    var longitude: String? by model

    @Label("纬度")
    var latitude: String? by model

    @Label("客服电话")
    var servicePhone: String? by model

    @Label("客服微信")
    var serviceWX: String? by model

    @Label("客服QQ")
    var serviceQQ: String? by model

    @Label("备注")
    var notes: String? by model

    companion object : ModelClass<Merchant>() {
        const val ST_ENABLE = 0
        const val ST_DISABLE = 1
    }
}

